<?php
class CaptcharAttr extends BaseAttr {
	var $securimage = null;
	public function CaptcharAttr($attr, $lang=null, $mutil_lang=false){
		parent::BaseAttr($attr, $lang, $mutil_lang);
		
		//创建一个验证码
		require_once ROOT_PATH . '/protected/includes/securimage/securimage.php';
		$this->securimage = new Securimage;
	}
	
	/**
	 * 获取Post数据
	 * @param array $getted_post_data 已经取到的表单数据
	 */
	public function get_post_val(&$getted_post_data){
		$name = $this->attr['id'];
		$captchar = $_POST[$name];
		if($this->securimage->check($captchar)==false){
			$this->error = Lang::get('captchar_error');
			return;
		}
	}
}

?>